<template>
	<view class="service">
		<view class="service-plate-1">
			<view class="title">
				<view class="bian">
					
				</view>
				<text>自助服务</text>
			</view>
			<view class="content">
				<view class="item" v-for="(item,index) in icoList" :key="index" @click="goService(item.base_pics_id,item.pic_name)">
					<image :src="item.picture" mode=""></image>
					<text>{{item.pic_name}}</text>
				</view>
			</view>
		</view>
		<view class="service-plate-2">
			<view class="title">
				<view class="bian">
					
				</view>
				<text>热门问题</text>
			</view>
			<view class="item" v-for="(item,index) in hotList" :kety="index" @click="goListDetail(item.self_service_id)">
				<text>{{item.service_title}}</text>
				<u-icon name="arrow-right" color="#666" size="20"></u-icon>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				icoList:[],
				hotList:[]
			};
		},
		created() {
			this.getZizhu()
			this.getHot()
		},
		methods:{
			// 前往问题详情页面
			goListDetail(id){
				uni.navigateTo({
					url:'serviceTwo/listDetail/listDetail?id=' + id
				})
			},
			// 前往问题列表页面
			goService(id,name){
				uni.navigateTo({
					url:'serviceTwo/serviceTwo?id=' + id + '&name=' + name
				})
			},
			// 请求热门问题
			getHot(){
				uni.request({
				    url:this.$Url +'/index.php/App/Service/hotServiceList',
				    method:'POST',
				    data:{
				       p:1
				    },
				    header:{
				        "token":uni.getStorageSync('token')
				    },
				    success: (res) => {
				       if (res.data.status == 200) {
							this.hotList = res.data.data.hot_self_service_list
				       } else{
							uni.showToast({
								title:res.data.msg,
								icon:'none',
								duration:1200
							})
				       }
				    }
				})
			},
			// 请求自助服务
			getZizhu(){
				uni.request({
				    url:this.$Url +'/index.php/App/Service/selfServiceLabel',
				    method:'POST',
				    data:{
				       
				    },
				    header:{
				        "token":uni.getStorageSync('token')
				    },
				    success: (res) => {
				       if (res.data.status == 200) {
							this.icoList = res.data.data
				       } else{
							uni.showToast({
								title:res.data.msg,
								icon:'none',
								duration:1200
							})
				       }
				    }
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.service{
	width: 100vw;
	min-height: 100vh;
	background-color: #f7f7f7;
	.service-plate-1{
		background-color: #fff;
		.title{
			width: 100%;
			margin-left: 30upx;
			height: 80upx;
			display: flex;
			align-items: center;
			border-bottom: 1upx solid #e7e7e7;
			.bian{
				width: 6upx;
				height: 44upx;
				margin-right: 15upx;
				background-color: $zhuti-color;
			}
			text{
				font-size: 27upx;
				color: #333;
			}
		}
		.content{
			display: flex;
			align-items: center;
			justify-content: space-between;
			flex-wrap: wrap;
			padding: 0upx 50upx;
			padding-top: 30upx;
			.item{
				display: flex;
				align-items: center;
				justify-content: center;
				flex-direction: column;
				margin-bottom: 30upx;
				width: 25%;
				image{
					width: 66upx;
					height: 66upx;
					margin-bottom: 15upx;
				}
				text{
					font-size: 24upx;
					color: #333;
				}
			}
		}
	}
	.service-plate-2{
		background-color: #fff;
		margin-top: 20upx;
		.title{
			width: 100%;
			margin-left: 30upx;
			height: 80upx;
			display: flex;
			align-items: center;
			border-bottom: 1upx solid #e7e7e7;
			.bian{
				width: 6upx;
				height: 44upx;
				margin-right: 15upx;
				background-color: $zhuti-color;
			}
			text{
				font-size: 27upx;
				color: #333;
			}
		}
		.item{
			width: 100%;
			border-bottom: 1upx solid #e7e7e7;
			height: 78upx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 0 30upx;
			text{
				font-size: 26upx;
				color: #666;
			}
		}
	}
}
</style>
